//
//  HMSearchView.swift
//  WeiBoXR
//
//  Created by acer on 16/9/20.
//  Copyright © 2016年 acer. All rights reserved.
//

import UIKit

class HMSearchView: UIView {

    @IBOutlet weak var searchTextField: UITextField!
    @IBOutlet weak var searchBtn: UIButton!
    @IBOutlet weak var searchRightConstraint: NSLayoutConstraint!
    

    @IBAction func searchEditingClick(_ sender: AnyObject) {
        
        searchRightConstraint.constant = searchBtn.width
        UIView.animate(withDuration: 0.3) { 
            self.layoutIfNeeded()
        }
    }
    @IBAction func searchBtnClick(_ sender: AnyObject) {
        
        searchTextField.resignFirstResponder()
        searchRightConstraint.constant = 3
        UIView.animate(withDuration: 0.3) {
            self.layoutIfNeeded()
        }
    }
    
    class func hmsearchView() -> HMSearchView {
        return UINib(nibName: "HMSearchView", bundle: nil).instantiate(withOwner: nil, options: nil).last as! HMSearchView
    }

//    override func awakeFromNib() {
//        searchTextField.layer.borderColor = UIColor.orange.cgColor
//        searchTextField.layer.borderWidth = 2
//        searchTextField.layer.cornerRadius = 5
//        searchTextField.layer.masksToBounds = true
//    }
}
